package request

import (
	"yundian/internel/app/models/coupon"
	"yundian/internel/app/models/goods"
	"yundian/internel/app/models/reports"
	"yundian/internel/app/models/room"
)

type GetDrawGoodsPrizeListRes struct {
	Phone string `gorm:"column:phone" json:"phone"`
	Name  string `gorm:"column:name" json:"name"`
}

type WxReceiveCouponReq struct {
	CouponRecordId int `json:"couponRecordId"`
	MemberId       int
}

type GetWxUseCouponListReq struct {
	PlaceId  int    `json:"placeId"`
	DeviceSn string `json:"deviceSn"`
	MemberId int
}

type GetWxUseChargeCouponListReq struct {
	PlaceId  int    `json:"placeId"`
	DeviceSn string `json:"deviceSn"`

	Openid   string
	MemberId int
}

type GetWxUseChargeCouponListRes struct {
	Id        int    `gorm:"id" json:"id"`
	Type      uint8  `gorm:"type" json:"type"`
	Discounts int    `gorm:"discounts" json:"discounts"`
	Threshold int    `gorm:"threshold" json:"threshold"`
	Name      string `gorm:"name" json:"name"`
	EndTime   int64  `gorm:"end_time" json:"endTime"`
}

type GetWxReceiveCouponListReq struct {
	PlaceId  int    `json:"placeId"`
	DeviceSn string `json:"deviceSn"`

	Status   uint8
	MemberId int
}

type GetWxReceiveCouponListRes struct {
	coupon.OrderCouponRecord
	Num int `gorm:"column:num" json:"num"`
}

type InsertPlaceReportReq struct {
	reports.PlaceReportsDb
}

type GetStewardGoodsOrderDetailsReq struct {
	MemberId int
	TradeNo  string `json:"tradeNo"`
}

type GetStewardGoodsOrderDetailsRes struct {
	GoodsOrderList     []*GetStewardGoodsOrderListRes `json:"goodsOrderList"`
	Status             uint8                          `gorm:"column:status" json:"status"`
	NotificationStatus uint8                          `gorm:"column:notification_status" json:"notificationStatus"`
	NotificationId     int                            `gorm:"column:notification_id" json:"notificationId"`
	StaffId            int                            `gorm:"column:staff_id" json:"staffId"`
	Room               string                         `gorm:"column:room" json:"room"`
	CreateTime         string                         `gorm:"column:create_time" json:"createTime"`
	PayTime            string                         `gorm:"column:pay_time" json:"payTime"`
	PlaceName          string                         `gorm:"column:place_name" json:"placeName"`
	TradeNo            string                         `gorm:"column:trade_no" json:"tradeNo"`
	Message            string                         `gorm:"column:message" json:"message"`
}
type GetStewardGoodsOrderListRes struct {
	Id             int    `gorm:"column:id" json:"orderId"`
	GoodsId        int    `gorm:"column:goods_id" json:"goodsId"`
	Price          int    `gorm:"column:price" json:"price"`
	Amount         int    `gorm:"column:amount" json:"amount"`
	BuyNum         int    `gorm:"column:buy_num" json:"buyNum"`
	Name           string `gorm:"column:name" json:"name"`
	Icon           string `gorm:"column:icon" json:"icon"`
	PayTime        string `gorm:"column:pay_time" json:"-"`
	Room           string `gorm:"column:room" json:"-"`
	NotificationId int    `gorm:"column:notification_id" json:"-"`
	PlaceName      string `gorm:"column:place_name" json:"-"`
	CreateTime     string `gorm:"column:create_time" json:"-"`
	Status         uint8  `gorm:"column:status" json:"-"`
	Message        string `gorm:"column:message" json:"-"`
	TradeNo        string `gorm:"column:trade_no" json:"-"`
}

type SetGoodsBuyCartReq struct {
	PlaceId  int `json:"placeId"`
	GoodsId  int `json:"goodsId"`
	BuyNum   int `json:"buyNum"`
	MemberId int
}

type GetStewardGoodsBuyCartReq struct {
	BaseListReq
	PlaceId  int `json:"placeId"`
	MemberId int
}

type GetStewardGoodsBuyCartRes struct {
	goods.BuyCartUpdate
	Icon           string `gorm:"column:icon" json:"icon"`                      // 商品图标
	Name           string `gorm:"column:name" json:"name"`                      // 商品名称
	Status         int    `gorm:"column:status" json:"status"`                  // 数量
	Num            int    `gorm:"column:num" json:"num"`                        // 数量
	TargetPrice    int    `gorm:"column:t_price" json:"price"`                  // 价格 单位：分
	DiscountAmount int    `gorm:"column:discount_amount" json:"discountAmount"` // 优惠 单位：分
}

type GetStewardGoodsOrderReq struct {
	BaseListReq
	Status   uint8 `json:"status"`
	MemberId int
	PlaceId  int    `json:"placeId"`
	TypeName string `json:"typeName"`
}

type GetStewardGoodsOrderRes struct {
	goods.Orders
}

// GetStewardGoodsOrderReq 查询商品列表
type GetStewardGoodsReq struct {
	BaseListReq
	BuyType  uint8  `json:"buyType"`
	PlaceId  int    `json:"placeId"`
	TypeName string `json:"typeName"`
}

type GetStewardGoodsOrderTypeRes struct {
	PlaceId  int    `gorm:"column:place_id" json:"placeId"`
	TypeName string `gorm:"column:type_name" json:"typeName"`
}

// 重新支付
type AgainStewardOrderReq struct {
	TradeNo string `json:"tradeNo"`
	Openid  string `json:"openid" binding:"required"`
}

// GetRoomOrderListReq 查询续住订单
type GetRoomOrderListReq struct {
	BaseListReq
	Status   uint8 `json:"status"`
	MemberId int
}

// GetRoomOrderDetailsReq 查询房间订单详情
type GetRoomOrderDetailsReq struct {
	NotificationId int `json:"notificationId"`
	MemberId       int
}

// GetRoomTypeListReq 查询房间类型
type GetRoomTypeListReq struct {
	PlaceId  int    `json:"placeId"`
	DeviceSn string `json:"deviceSn"`
	Room     string `json:"room"`
}

// GetRoomTypeListRes 查询房间类型
type GetRoomTypeListRes struct {
	room.TypeDb
	RoomId int `gorm:"column:room_id" json:"roomId"` // 房间id
	Num    int `gorm:"column:num" json:"num"`        // 可以入住房间数
}

// TicketCreateOrdersReq 创建订单
type TicketCreateOrdersReq struct {
	MemberId int    `json:"memberId"`
	TicketId int    `json:"ticketId"`
	Openid   string `json:"openid"`
	DeviceSn string `json:"deviceSn"` // 设备标识

	Amount  int
	Key     string
	TradeNo string
}

// CreateStewardOrderReq 微信小程序 创建续住订单/商品订单
type CreateStewardOrderReq struct {
	DeviceSn string `json:"deviceSn" binding:"required"` // 设备标识
	Openid   string `json:"openid" binding:"required"`
	ClientIp string `json:"clientIp"`
	UserId   int    `json:"userId"`
	PlaceId  int    `json:"placeId"`
	Message  string `json:"message"`

	// 续住
	RoomTypeId  int    `json:"roomTypeId"`
	RoomId      int    `json:"roomId"`
	InTime      string `json:"inTime"`
	LeaveTime   string `json:"leaveTime"`
	MemberName  string `json:"memberName"`
	MemberPhone string `json:"memberPhone"`

	// 商品
	GoodsList []GoodsList `json:"goodsList"`
	RoutesId  uint8       `json:"routesId"`

	// 门票ID
	TicketId int `json:"ticketId"`

	Amount  int `json:"amount"`
	Key     string
	TradeNo string
}

type GoodsList struct {
	Id  int `json:"id"`
	Num int `json:"num"`
}

// 微信小程序 创建订单-统一下订单API
type CreateOrderReq struct {
	Appid         string `json:"appid"`
	DeviceSn      string `json:"deviceSn" binding:"required"` // 设备标识
	ProductId     string `json:"productId"`                   //
	DeviceModelId string `json:"deviceModelId"`               //
	Openid        string `json:"openid" binding:"required"`   // 用户openid
	FeeMode       int    `json:"feeMode"`
	ClientIp      string `json:"clientIp"` //
	UserId        int    `json:"userId"`
	PlaceId       int    `json:"placeId"`

	CouponInfoId int `json:"couponInfoId"`
}

// 微信小程序 获取密码、重置密码、继续使用
type GetPasswordReq struct {
	DeviceSn  string `json:"deviceSn" form:"deviceSn" binding:"required"` // 设备标识
	ProductId string `json:"productId"`
	Openid    string `json:"openid" binding:"required"` // 用户openid
	TradeNo   string `json:"tradeNo"`                   // 订单号
}

type DevPasswordVerifyCRC16Req struct {
	Message string `json:"message" form:"message"`
	Type    uint8  `json:"type" form:"type"`
}
